#include "QApplication"
#include "GAThread.h"
#include "QSemaphore"
#include "OSCthulhuClient.h"

int main(int argc, char *argv[])
{
    QSemaphore* wait4CleanupDone = new QSemaphore(1);
    int r;
    QApplication a(argc, argv);
    OSCthulhuClient* client = new OSCthulhuClient(QString(argv[2]),QString(argv[3]),QString(argv[4]),QString(argv[5]),atoi(argv[6]),atoi(argv[7]),atoi(argv[8]),wait4CleanupDone);
    QObject::connect(&a, SIGNAL(aboutToQuit()), client, SLOT(handleQuit()));
    QThread *gaThread = new GAThread(client);
    //QObject::connect(gaThread,SIGNAL(sendCandidate(osc::OutboundPacketStream)),client,SLOT(sendServerSlot(osc::OutboundPacketStream)));
    r = a.exec();
    wait4CleanupDone->acquire();
    return r;
}
